//
//  QYMPopBaseVC.m
//
//
//  Created by LZ on 2018/6/15.
//  Copyright © 2018年 LZ. All rights reserved.
//

#import "QYMPopBaseVC.h"
#import "QYMPresentationController.h"

@interface QYMPopBaseVC ()<UIViewControllerTransitioningDelegate>

@end

@implementation QYMPopBaseVC

- (id)init{
    
    self = [super init];
    if (self) {
        [self initData];
    }
    return self;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if(self){
        [self initData];
    }
    return self;
}

- (id)initWithCoder:(NSCoder *)coder{
    
    self = [super initWithCoder:coder];
    if(self){
        [self initData];
    }
    return self;
}

- (void)initData{
    
    self.modalPresentationStyle = UIModalPresentationCustom;
    self.modalTransitionStyle   = UIModalTransitionStyleCoverVertical;
    self.transitioningDelegate  = self;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

- (void)dismissVC{
    [self dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - UIViewControllerTransitioningDelegate
- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented presentingViewController:(UIViewController *)presenting sourceViewController:(UIViewController *)source
{
    CGFloat height = self.viewHeight;
    
    return [[QYMPresentationController alloc] initWithPresentedViewController:presented
                                                    presentingViewController:presenting
                                                               contentHeight:height];
}


@end
